import os

from flask import Blueprint, send_from_directory
from flask_login import login_required
from config import config_settings

uploads_file = Blueprint('uploads_file', __name__, url_prefix='/uploads_file')


@uploads_file.route('/videos/<filename>', methods=['GET'])
@login_required
def videos(filename):
    image_absolute_path = os.path.abspath(config_settings.VIDEO_UPLOAD_FOLDER)
    return send_from_directory(image_absolute_path, filename)
